package com.termine.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class Connector {

	public static Connection getConnection() throws ClassNotFoundException, SQLException {
			Class.forName("com.ibm.db2.jcc.DB2Driver");
			String url = "jdbc:db2://vampir.cosy.sbg.ac.at:50001/DBVWS12";
			return DriverManager.getConnection(url, "cline", "h!jsfu382!2");			
	}
	
	public static void closeConnection(Connection connection) throws SQLException {
		if (connection != null) {
			connection.close();
		}
	}
	
}